# Maintainer: Celeste <cielesti@protonmail.com>
maintainer="Celeste <cielesti@protonmail.com>"
pkgname=iamb
pkgver=0.0.10
pkgrel=0
pkgdesc="Rust Matrix chat client with Vim keybindings"
url="https://iamb.chat/"
# x86, armv7, armhf: fails tests
# s390x: nix crate
arch="all !x86 !armv7 !armhf !s390x"
license="Apache-2.0"
makedepends="
	cargo
	cargo-auditable
	openssl-dev
	sqlite-dev
	"
subpackages="$pkgname-doc"
source="https://github.com/ulyssa/iamb/archive/v$pkgver/iamb-$pkgver.tar.gz
	update-libc-crate.patch
	"
_cargo_flags="--no-default-features --features=desktop,native-tls --frozen"

prepare() {
	default_prepare

	cargo fetch --target="$CTARGET" --locked
}

build() {
	cargo auditable build --release $_cargo_flags
}

check() {
	cargo test $_cargo_flags
}

package() {
	install -Dm755 target/release/iamb -t "$pkgdir"/usr/bin/

	install -Dm644 docs/iamb.1 -t "$pkgdir"/usr/share/man/man1/
	install -Dm644 docs/iamb.5 -t "$pkgdir"/usr/share/man/man5/

	install -Dm644 iamb.desktop -t "$pkgdir"/usr/share/applications/

	install -Dm644 docs/iamb-256x256.png -t "$pkgdir"/usr/share/icons/hicolor/256x256/apps/
	install -Dm644 docs/iamb-512x512.png -t "$pkgdir"/usr/share/icons/hicolor/512x512/apps/
	install -Dm644 docs/iamb.svg -t "$pkgdir"/usr/share/icons/hicolor/scalable/apps/

	install -Dm644 config.example.toml -t "$pkgdir"/usr/share/iamb/
}

sha512sums="
76b0fb1f4f1fa8683a6ec235dec5d129358c130ee98a70f8f099cbccee847666318aa082791f2e8dbce5232a5bcfd3a37f34230db5ab60ad478fa6f0cd7b3eaa  iamb-0.0.10.tar.gz
e113ce7e728c6e98a703b0800c699830ed5f709ef34d42216df9a1c54c358a81836ecfe23aae31dbeca9b4b5225a6331018b441b1bad695355d2071ec9369a52  update-libc-crate.patch
"
